﻿//-----------------------------------------------------------------------
// <copyright file="Host.cs" company="DylanBox">
// Copyright (c) DylanBox Corporation. All rights reserved.
// </copyright>
// <summary>This class support to get information of the host machine</summary>
// <author>Dylan</author>
//-----------------------------------------------------------------------

using System;
using System.Net;

namespace SDFL.Core
{
    /// <summary>
    /// Host class, get information of host machine
    /// </summary>
    /// <history>
    ///     [Dylan]     2010-4-14       Created
    /// </history>
    public class Host
    {
        /// <summary>
        /// Gets the host machine's IP
        /// </summary>
        public static string IP
        {
            get
            {
                string strHostIP = "";     
                
                IPHostEntry objIPHost = Dns.GetHostEntry(Name);
                if (objIPHost.AddressList.Length > 0)
                    strHostIP = objIPHost.AddressList[0].ToString();

                return strHostIP;
            }
        }

        /// <summary>
        /// Gets the host's machine name
        /// </summary>
        public static string Name
        {
            get
            {
                string strHostName = string.Empty;
                strHostName = Environment.MachineName;

                return strHostName;
            }
        }
    }
}
